package com.example.lianxi222;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

public class CustomRecycler extends RecyclerView {
    private boolean isIntercept=true;


    public CustomRecycler(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public void setIntercept(boolean intercept){
         isIntercept=intercept;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent e) {
        if(!isIntercept){
            return false;
        }
        return super.onInterceptTouchEvent(e);
    }
}
